<?php
@session_start();
$db = new Libs_Database();
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title>Gstore</title>
        <?php
        include_once 'templates/render.php';
        $render = new render();
        $arrFileCSS = array(
            'style.css',
            'nivo-slider.css',
            'default/default.css',
            'ui-lightness/jquery-ui-1.10.4.min.css'
        );
        $render->renderCSS('default', $arrFileCSS);
        $arrFileJS = array(
            'jquery.js',
            'jquery.validate.min.js',
            'messages_vi.js',
            'ajax.js',
            'jquery-ui-1.10.4.min.js',
            'jquery.nivo.slider.pack.js',
            'jquery.elevatezoom.js',
            'custom.js'
        );
        $render->renderJS('default', $arrFileJS);
        ?>
        <script type="text/javascript">
            var BASE_URL = '<?PHP echo URL_BASE ?>';
            $(function() {
//                $("#big").elevateZoom({zoomWindowPosition: 1, zoomWindowOffetx: 10});
                $(".datepicker").datepicker({
                    dateFormat: "dd/mm/yy"
                });
            });

        </script>
    </head>
    <body>
        <div id="fb-root"></div>
        <script type="text/javascript">(function(d, s, id) {
                var js, fjs = d.getElementsByTagName(s)[0];
                if (d.getElementById(id))
                    return;
                js = d.createElement(s);
                js.id = id;
                js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
                fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk'));</script>
        <div id="wrap">
            <div id="header">
                <div class="top-menu">
                    <ul>
                        <li><a href="<?php echo URL_BASE; ?>/intro">Giới thiệu</a></li>
                        <li><a href="<?php echo URL_BASE; ?>/cart">Giỏ hàng</a></li>
                        <li><a href="<?php echo URL_BASE; ?>/contact">Liên hệ</a></li>
                        <?php
                        if (isset($_SESSION['user'])) {
                            ?>
                            <li class="lr"><?php echo "Xin chào! " . $_SESSION['user'] . "."; ?><a href="<?php echo URL_BASE; ?>/customer/logout">Thoát</a></li>
                            <?php
                        } else {
                            ?>
                            <li class="lr"><a href="<?php echo URL_BASE; ?>/customer/register">Đăng ký</a></li>
                            <li class="lr"><a href="<?php echo URL_BASE; ?>/customer">Đăng nhập</a></li>
                            <?php
                        }
                        ?>
                    </ul>
                </div>
                <div class="top-banner">
                    <div id="logo">
                        <a href="<?php echo URL_BASE; ?>"><img src="<?php echo URL_BASE; ?>/templates/default/css/img/logo.png" width="210"></a>
                    </div>
                    <div id="top-cart">
                        <a href="<?php echo URL_BASE; ?>/cart"><img src="<?php echo URL_BASE; ?>/templates/default/css/img/cart.png" align="middle" style="margin-top: -12px;"></a>
                        <div style="display: inline-block;font-size: 14px;">
                            <span><a href="<?php echo URL_BASE; ?>/cart" style="color:#000;margin:0;padding:0;">Giỏ hàng</a>:<a href="<?php echo URL_BASE; ?>/cart"><?php echo count($_SESSION['cart']); ?></a> sản phẩm</span>
                        </div>
                    </div>
                    <div class="search-box">
                        <form name="searchForm" action="<?php echo URL_BASE; ?>/product" method="get">
                            <input type="text" id="search-box" name="keyword" placeholder="Nhập từ khóa tìm kiếm..." />
                        </form>
                    </div>
                </div>
                <?php
                require 'menu.php';
                ?>
            </div>